﻿using System;
using System.Collections.ObjectModel;
using MugenInjection.Interface;

namespace MugenInjection.Web.Interface
{
    /// <summary>
    /// Providing configuration for <see cref="MugenInjectionHttpApplication"/>.
    /// </summary>
    public interface IApplicationConfiguration : IDisposable
    {
        /// <summary>
        /// Gets or sets the <see cref="IInjector"/> that is used in the application.
        /// </summary>
        IInjector Injector { get; }

        /// <summary>
        /// Gets all current configurations.
        /// </summary>
        ReadOnlyCollection<IConfiguration> Configurations { get; }

        /// <summary>
        /// Adds the specified <see cref="IConfiguration"/>.
        /// </summary>
        /// <param name="configuration">The specified <see cref="IConfiguration"/>.</param>
        void AddConfiguration(IConfiguration configuration);

        /// <summary>
        /// Removes the specified <see cref="IConfiguration"/>.
        /// </summary>
        /// <param name="configuration">The specified <see cref="IConfiguration"/>.</param>
        void RemoveConfiguration(IConfiguration configuration);

        /// <summary>
        /// Occured when the application is starting.
        /// </summary>
        event Action<MugenInjectionHttpApplication> ApplicationStarting;

        /// <summary>
        /// Occured when the application is started.
        /// </summary>
        event Action<MugenInjectionHttpApplication> ApplicationStarted;

        /// <summary>
        /// Occured when the application is stopped.
        /// </summary>
        event Action<MugenInjectionHttpApplication> ApplicationStopped;

        /// <summary>
        /// Handles the Start event of the Session.
        /// </summary>
        event Action<MugenInjectionHttpApplication> SessionStart;

        /// <summary>
        /// Occured when the session is ended.
        /// </summary>
        event Action<MugenInjectionHttpApplication> SessionEnd;

        /// <summary>
        /// Handles the BeginRequest event of the Application.
        /// </summary>
        event Action<MugenInjectionHttpApplication> BeginRequest;

        /// <summary>
        /// Occured when the request is ended.
        /// </summary>
        event Action<MugenInjectionHttpApplication> EndRequest;

        /// <summary>
        /// Handles the AuthenticateRequest event of the Application.
        /// </summary>
        event Action<MugenInjectionHttpApplication> AuthenticateRequest;

        /// <summary>
        /// Handles the Error event of the Application.
        /// </summary>
        event Action<MugenInjectionHttpApplication> ApplicationError;
    }
}